
#INCNRCAPNWIN7_A9TRULP_C40_W3 INCNRCAPNWOUT7_A9TRULP_C40_W3
setEndCapMode -reset
setEndCapMode \
-leftTopCorner CNRCAPNWIN7_A9TRULP_C40_W3 \
-leftBottomCorner CNRCAPNWOUT7_A9TRULP_C40_W3 \
-prefix ENDCAP 
addEndCap

deselectAll
selectInst [dbget top.insts.name *ENDCAP*]
flipOrRotateObject -flip MY -keepRelative
deselectAll

setEndCapMode -reset
setEndCapMode \
-rightBottomEdge INCNRCAPNWOUT7_A9TRULP_C40_W3 \
-prefix ENDCAP
addEndCap


#setEndCapMode -reset
#setEndCapMode \
#-rightBottomEdge INCNRCAPNWIN7_A9TRULP_C40_W3 \
#-prefix ENDCAP
#addEndCap
#
#foreach inst [dbget [dbget -p2 top.insts.cell.name INCNRCAPNWIN7_A9TRULP_C40_W3].name] {
#		set orient [dbget [dbget -p top.insts.name $inst].orient]
#		if {$orient == "MX"} {
#				dbset [dbget -p top.insts.name $inst].orient R0
#		} elseif {$orient == "R0"} {
#				dbset [dbget -p top.insts.name $inst].orient MX
#		} elseif {$orient == "R180"} {
#				dbset [dbget -p top.insts.name $inst].orient MY
#		} elseif {$orient == "MY"} {
#				dbset [dbget -p top.insts.name $inst].orient R180
#		} else {
#				continue
#		}
#}

setEndCapMode -reset
setEndCapMode \
-rightTopEdge INCNRCAPNWIN7_A9TRULP_C40_W3 \
-prefix ENDCAP
addEndCap


setEndCapMode -reset
setEndCapMode -prefix ENDCAP
addEndCap -preCap ENDCAPTIE7_A9TRULP_C40_W3 -postCap ENDCAPTIE7_A9TRULP_C40_W3


set BOTTOM_ENDCAP_CELL "TBCAPNWOUT1_A9TRULP_C40_W3 TBCAPNWOUT128_A9TRULP_C40_W3"
#set BOTTOM_ENDCAP_CELL "TBCAPNWIN1_A9TRULP_C40_W3 TBCAPNWIN128_A9TRULP_C40_W3"
set TOP_ENDCAP_CELL "TBCAPNWIN1_A9TRULP_C40_W3 TBCAPNWIN128_A9TRULP_C40_W3"
setEndCapMode -reset
setEndCapMode \
-bottomEdge $BOTTOM_ENDCAP_CELL \
-topEdge $TOP_ENDCAP_CELL \
-prefix ENDCAP
addEndCap



#foreach inst [dbget top.insts.name *ENDCAP*] {deleteInst $inst}


#setEndCapMode -reset
#setEndCapMode \
#-leftEdge $LEFT_ENDCAP_CELL \
#-rightEdge $RIGHT_ENDCAP_CELL \
#-bottomEdge $BOTTOM_ENDCAP_CELL \
#-topEdge $TOP_ENDCAP_CELL \
#-leftTopCorner $CONNER_ENDCAP_CELL \
#-leftBottomCorner $CONNER_ENDCAP_CELL \
#-rightTopEdge $CONNER_ENDCAP_CELL \
#-rightBottomEdge $CONNER_ENDCAP_CELL \
#-prefix ENDCAP 
#
#deselectAll
#selectInst [dbget [dbget -p2 top.insts.cell.name CNRCAPNWIN7_A9TRULP_C40_W3].name ]
#flipOrRotateObject -flip MY -keepRelative
#deselectAll



#foreach inst [dbget [dbget -p2 top.insts.cell.name CNRCAPNWIN7_A9TRULP_C40_W3].name ] {
#		set pt [dbget [dbget -p top.insts.name $inst].pt]
#		set orient [dbget [dbget -p top.insts.name ENDCAP_8537].orient]
#		puts "$inst $orient $pt"
#		addInst -cell CNRCAPNWOUT7_A9TRULP_C40_W3 -loc $pt -ori $orient -physical -inst ${inst}_NWOUT -status fixed
#}




#deselectAll
##selectInst [dbget [dbget -p [dbget -p top.insts.name ENDCAP*].pt_x 1107.46]]
#selectInst [dbget [dbget -p [dbget -p top.insts.name ENDCAP*].pt_x 2996.68]]
#flipOrRotateObject -flip MY -group
#deselectAll

############################################

